    
    TSLS = function(Z,D,Y,X, weights){
        stageI  = lm(D ~ Z + X - 1, weights = weights)
        Dhat    = predict(stageI)
        stageII = lm(Y ~ Dhat + X - 1, weights = weights)
        stageII$coefficients["Dhat"]
    }
